/**
 * Copyright &copy; 2012-2016 <a href="https://www.kaaction.com">KAA</a> All rights reserved All rights reserved.
 */
package com.kaaction.modules.mer.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.google.common.collect.Lists;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

import com.kaaction.common.persistence.TreeEntity;

/**
 * 分类Entity
 * @author huanghaiming
 * @version 2017-05-16
 */
public class MerClassify extends TreeEntity<MerClassify> {
	
	private static final long serialVersionUID = 1L;
	private MerClassify parent;		// parent_id
	private String parentIds;		// parent_ids
	private String name;		// 名称
	private Integer sort;		// 排序
	private String brief;		// 概述
	
	private String classifyId;		// 概述
	
	private String isSpecial; //特殊商品
	
	
	private List<Attribute> eventAttList = Lists.newArrayList();	
	
	List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
	
	public MerClassify() {
		super();
	}

	public MerClassify(String id){
		super(id);
	}

	@JsonBackReference
	@NotNull(message="parent_id不能为空")
	public MerClassify getParent() {
		return parent;
	}

	public void setParent(MerClassify parent) {
		this.parent = parent;
	}
	
	@Length(min=1, max=4000, message="parent_ids长度必须介于 1 和 4000 之间")
	public String getParentIds() {
		return parentIds;
	}

	public void setParentIds(String parentIds) {
		this.parentIds = parentIds;
	}
	
	@Length(min=1, max=64, message="名称长度必须介于 1 和 64 之间")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@NotNull(message="排序值不能为空")
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}
	
	@Length(min=0, max=500, message="概述长度必须介于 0 和 500 之间")
	public String getBrief() {
		return brief;
	}

	public void setBrief(String brief) {
		this.brief = brief;
	}
	
	public String getParentId() {
		return parent != null && parent.getId() != null ? parent.getId() : "0";
	}

	public List<Attribute> getEventAttList() {
		return eventAttList;
	}

	public void setEventAttList(List<Attribute> eventAttList) {
		this.eventAttList = eventAttList;
	}

	public String getClassifyId() {
		return classifyId;
	}

	public void setClassifyId(String classifyId) {
		this.classifyId = classifyId;
	}

	public List<Map<String, Object>> getList() {
		return list;
	}

	public void setList(List<Map<String, Object>> list) {
		this.list = list;
	}

	public String getIsSpecial() {
		return isSpecial;
	}

	public void setIsSpecial(String isSpecial) {
		this.isSpecial = isSpecial;
	}
	
}